<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/pages/common/taglibs.jsp"%>
<s:bean name="com.admission.util.ArrayUtils" var="data"></s:bean>
<s:set var="arraymap" value="#data.getMap()" ></s:set>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>广东工业大学招生办后台管理</title>
<link rel="stylesheet" href="${ctx }/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="${ctx }/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="${ctx }/kindeditor/lang/zh_CN.js"></script>

<script>
	var editor;
	KindEditor.ready(function(K) {
		editor = K.create('textarea[id=="content"]', {
			cssPath : '${ctx}/kindeditor/plugins/code/prettify.css',
				uploadJson :  '${ctx}/kindeditor/jsp/upload_json.jsp',  
				fileManagerJson : '${ctx}/kindeditor/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['article'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['article'].submit();
					});
				}
			});
			prettyPrint();
		});
	function check(){
		var title = document.getElementById("title");
		var rank = document.getElementById("rank");
		var type=document.getElementById("type");
		if(title.value==""){
			alert("请输入标题！");
			return false;
		}
		if(rank.value==""){
			alert("请输入职称！");
			return false;
		}
		if(type.value==""){
			alert("请输入名师类别！");
			return false;
		}
		if(editor.isEmpty()){
			alert("请输入内容！");
			return false;
		}
		/* if(editor.html().length>800){
			alert("介绍不能大于800个字");
			return false;
		} */
		else true;
	}
</script>

</head>
<body>
	<div class="article">
		<form action="teacher-view-admin!save.action?id=${entity.id}" enctype="multipart/form-data" method="post"  name="article" onsubmit="return check()">
		<input type="hidden" name="value" value="${value}"/>
			<table style="width:100%">
				<tr>
					<td>姓名：</td>
					<td><input type="text" maxlength="26" id="title" name="entity.name" value="${entity.name}" style="width:100%"/></td>
				</tr>
				<tr>
					<td>职称：</td>
					<td><input type="text" maxlength="26" id="rank" name="entity.rank" value="${entity.rank}" style="width:100%"/></td>
				</tr>
				<tr>
					<td>名师类别：</td>
					<td>
					<select name="entity.type"  style="width:100%" id="type">
					<option value="${entity.type}"><s:property value="#arraymap.get(type)" /></option>
						<s:iterator value="arrayList">
						<option value="${itemName}">${itemValue}</option>
						</s:iterator>
						</select>
					</td>
				</tr>
				<tr>
					<td>内容：</td>
					<td>
						<textarea name="entity.introduction" id="content" style="width:100%;height:400px;visibility:hidden;">${entity.introduction }</textarea>
					</td>
				</tr>
				<tr>
					<td>照片：</td>
					<td>
						<img src="${ctx}/upload/${photoUrl}" width="106" height="136"  />
						<input type="file" name="picture" />
					</td>
				</tr>
				<tr>
					<td> </td>
					<td align="right">
						<input type="submit" class="button" style="width:80px;" value="提交"/> 
					</td>
				</tr>
			</table>
				
			<script>
				// Replace the <textarea id="editor1"> with an CKEditor instance.
				CKEDITOR.replace( 'editor1', {
					on: {
						focus: onFocus,
						blur: onBlur,

						// Check for availability of corresponding plugins.
						pluginsLoaded: function( evt ) {
							var doc = CKEDITOR.document, ed = evt.editor;
							if ( !ed.getCommand( 'bold' ) )
								doc.getById( 'exec-bold' ).hide();
							if ( !ed.getCommand( 'link' ) )
								doc.getById( 'exec-link' ).hide();
						}
					}
				});
			</script>

		</form>
	</div>
</body>
</html>
